#!/usr/bin/env python
#coding:utf-8
__author__ = 'carey'
__date__ = '2017/7/26 下午1:36'

from .models import Banner, Health, Link, Details, Nums

import xadmin
from xadmin import views


class GlobalSetting(object):
		site_title = 'carey'
		site_footer = 'carey'
		menu_style = 'accordion'


class BannerAdmin(object):
		list_display = ['title', 'img', 'url', 'add_time']
		search_fields = ['title', 'img', 'url']
		list_filter = ['title', 'img', 'url']


class HealthAdmin(object):
		list_display = ['title', 'content', 'auther', 'read_num', 'add_time']
		search_fields = ['title', 'content', 'auther', 'read_num', 'add_time']
		list_filter = ['title', 'content', 'auther', 'read_num', 'add_time']


class LinkAdmin(object):
		list_display = ['name', 'url', 'add_time']
		search_fields = ['name', 'url', 'add_time']
		list_filter = ['name', 'url', 'add_time']


class DetailsAdmin(object):
		list_display = ['d_id', 'class_id','name']
		search_fields = ['d_id', 'class_id', 'name']
		list_filter = ['d_id', 'class_id', 'add_time']


class NumsAdmin(object):
		list_display = ['num', 'add_time']

xadmin.site.register(Banner, BannerAdmin)
xadmin.site.register(Health, HealthAdmin)
xadmin.site.register(Link, LinkAdmin)
xadmin.site.register(Details, DetailsAdmin)
xadmin.site.register(Nums, NumsAdmin)
xadmin.site.register(views.CommAdminView, GlobalSetting)